package images;

import images.GameImagesMap;

import java.util.HashMap;
import java.util.Map;

import com.uqbar.vainilla.appearances.Animation;
import com.uqbar.vainilla.appearances.Sprite;

public class Images {

	public static GameImagesMap images = new GameImagesMap();
	
	public static Map<String, Sprite[]> animations;

	public static void init(){
		animations = new HashMap<String, Sprite[]>();
		
		Sprite sp1, sp2, bg, ast1, ast2, ast3, borderh, borderv, shipres;
		sp1 = Sprite.fromImage("/images/ship.png");
		sp1 = sp1.scaleTo(30, 30);
		images.addSprite("ship", sp1);
		
		sp2 = Sprite.fromImage("/images/laser1.png");
		sp2 = sp2.scaleTo(20, 15);
		images.addSprite("laser", sp2);
		
		bg = Sprite.fromImage("/images/mainbg.png");
		bg = bg.scaleTo(1000, 1000);
		images.addSprite("mainbg", bg);
		
		ast1 = Sprite.fromImage("/images/ast1.png");
		ast1 = ast1.scaleTo(30, 30);
		images.addSprite("asteroid1", ast1);
		
		ast2 = Sprite.fromImage("/images/ast2.png");
		ast2 = ast2.scaleTo(60, 60);
		images.addSprite("asteroid2", ast2);
		
		ast3 = Sprite.fromImage("/images/ast3.png");
		ast3 = ast3.scaleTo(100, 100);
		images.addSprite("asteroid3", ast3);
		
		borderh = Sprite.fromImage("/images/rayo_h.png");
		borderh = borderh.scaleTo(800, 30);
		images.addSprite("borderh", borderh);
		
		borderv = Sprite.fromImage("/images/rayo_v.png");
		borderv = borderv.scaleTo(30, 800);
		images.addSprite("borderv", borderv);
		
		shipres = Sprite.fromImage("/images/ship_spawning.png");
		shipres = shipres.scaleTo(30, 30);
		images.addSprite("ship_res", shipres);
		
		addAnimationExplode();
	}

	private static void addAnimationExplode() {
		Sprite[] sps = {
		
		Sprite.fromImage("/animations/explosion/exp01.png"),
		Sprite.fromImage("/animations/explosion/exp02.png"),
		Sprite.fromImage("/animations/explosion/exp03.png"),
		Sprite.fromImage("/animations/explosion/exp04.png"),
		Sprite.fromImage("/animations/explosion/exp05.png"),
		Sprite.fromImage("/animations/explosion/exp06.png"),
		Sprite.fromImage("/animations/explosion/exp07.png"),
		Sprite.fromImage("/animations/explosion/exp08.png"),
		Sprite.fromImage("/animations/explosion/exp09.png"),
		Sprite.fromImage("/animations/explosion/exp10.png"),
		Sprite.fromImage("/animations/explosion/exp11.png"),
		Sprite.fromImage("/animations/explosion/exp12.png"),
		Sprite.fromImage("/animations/explosion/exp13.png"),
		Sprite.fromImage("/animations/explosion/exp14.png"),
		Sprite.fromImage("/animations/explosion/exp15.png"),
		 };
		
		animations.put("explosion", sps);
	}

	public static Animation getExplosion(){
		Animation anim;
		anim = new Animation(0.08, animations.get("explosion"));
		return anim;
	}
}
